#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 1e5 + 10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int n, a[N], f[N]; //以i结尾的最长上升子序列
int main()
{
    close();
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];

    int num = 1, cur = 0;
    for(int i = 1; i < n; i++)
    {
        if(a[i] <= a[i - 1]) cur++;
        else cur = 0, num++;

    }
    reverse(a, a + n);
    int mx = 1;
    for(int i = 0; i < n; i++)
    {
        f[i] = 1;
        for(int j = 0; j < i; j++)
        {
            if(a[i] > a[j]) f[i] = max(f[i], f[j] + 1);
        }
        mx = max(mx, f[i]);
    }
    cout << mx << '\n' << num << '\n';


    return 0;
}